<%-- 
    Document   : display_news
    Created on : 10 Jul, 2012, 11:45:19 PM
    Author     : bharat
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page  import="java.sql.*"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>ONLINE COLLEGE MAGAZINE</title>

    </head>
    <body>
        <%

            Connection con2 = null;
            PreparedStatement pstmt1 = null;
            ResultSet rs1 = null;

            try {
                Class.forName("oracle.jdbc.driver.OracleDriver");
                con2 = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "aksh", "aksh");

                pstmt1 = con2.prepareStatement("select *from tblnews order by news_id");
                rs1 = pstmt1.executeQuery();
        %>
    <marquee behavior="scroll" direction="up" scrollamount="1" loop="true" vspace="2" height="40"> 
        <%
            while (rs1.next()) {
        %>

        <a href="display_news.jsp?nid=<%=rs1.getString(1)%>">
            <ul>
                <li><%=rs1.getString(2)%>
            </ul>
        </a>

        <%                    }

        %>
    </marquee>
    <%
        } catch (Exception e) {
            response.sendError(503, e.getMessage());
        } finally {
            if (rs1 != null) {
                try {
                    rs1.close();
                } catch (Exception e) {
                    response.sendError(555, e.getMessage());
                }
            }
            if (pstmt1 != null) {
                try {
                    pstmt1.close();
                } catch (Exception e) {
                    response.sendError(555, e.getMessage());
                }
            }
            if (con2 != null) {
                try {
                    con2.close();
                } catch (Exception e) {
                    response.sendError(555, e.getMessage());
                }
            }
        }

    %>
</body>
</html>
